import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'

export const routes: RouteRecordRaw[] = [
  {
    path: '/login',
    component: () => import('@/views/login/LoginPage.vue'),
  },

  {
    path: '/',
    component: () => import('@/views/LayOut.vue'),
    children: [
      {
        path: '/article',
        component: () => import('@/views/article/ArticlePage.vue'),
      },
      {
        path: '/',
        component: () => import('@/views/home/HomePage.vue'),
      },
      {
        path: '/publish',
        component: () => import('@/views/publish/PublishPage.vue'),
      },
      {
        path: '/user',
        component: () => import('@/views/user/UserPage.vue'),
      },
    ],
  },
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  scrollBehavior: () => ({ top: 0 }),
  routes,
})

export default router
